﻿using MyToDo.Common.Models;
using MyToDo.Service.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyToDo.Service.Login
{
    public class LoginService : ILoginService
    {
        private readonly HttpRestClient client;

        public LoginService(HttpRestClient client)
        {
            this.client = client;
        }
        public async Task<ApiResponse> LoginAsync(UserDto dto)
        {
            BaseRequest request = new BaseRequest();
            request.Method = RestSharp.Method.POST;
            request.Route = "api/Login/Login";
            request.Parameter = dto;
            return await client.ExecuteAsync(request);
        }

        public async Task<ApiResponse> ResgiterAsync(UserDto dto)
        {
            BaseRequest request = new BaseRequest();
            request.Method = RestSharp.Method.POST;
            request.Route = "api/Login/Resgiter";
            request.Parameter = dto;
            return await client.ExecuteAsync(request);
        }
    }
}
